import http from '../index'

// 分页获取角色
export const getRoles = ({ ascended = null, current = null, size = null, sortFieldName = null, roleKey = null, roleName = null, }) => {
    return http.get("roles", { ascended, current, size, sortFieldName, roleKey, roleName })
}

// 获取全部角色
export const getRolesAll = () => {
    return http.get("roles/all")
}

// 获取全部员工角色
export const getStaffRolesAll = () => {
    return http.get("roles/all-staff")
}

// 根据sid获取角色
export const getRoleDetail = ({ sid }) => {
    return http.get("roles/" + sid)
}

// 新增角色
export const addRole = ({ roleKey, roleName, dataScope = null, deletable = null, note = null, status = null, level = null, menuSids = null, programsMenuSids = null }) => {
    return http.post("roles", { roleKey, roleName, dataScope, deletable, note, status, level, menuSids, programsMenuSids })
}

// 修改角色
export const editRole = ({ sid, roleKey, roleName, dataScope = null, deletable = null, note = null, status = null, level = null, menuSids = null, programsMenuSids = null }) => {
    return http.put("roles/" + sid, { roleKey, roleName, dataScope, deletable, note, status, level, menuSids, programsMenuSids })
}

// 批量删除角色
export const delRoles = ({ sidList }) => {
    return http.put("roles/delete", { sidList })
}

